package com.mybatis.test;

import com.mybatis.simple.mapper.TPassengerMapper;
import com.mybatis.simple.pojo.TPassenger;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;

/**
 * @Author 咕唧
 * @Date 2022/5/17 20:14
 * @Version 1.0
 */
public class DemoTest3 {
    @Test
    public void Test5() throws IOException {
        InputStream inputStream = Resources.getResourceAsStream("mybatis-config.xml");
        SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
        SqlSession sqlSession = sessionFactory.openSession();

        TPassengerMapper passengerMapper = sqlSession.getMapper(TPassengerMapper.class);

        TPassenger passenger = passengerMapper.findWithTPassports(1L);
        System.err.println(passenger);
        sqlSession.close();
    }
}
